﻿using NUnit.Framework;

namespace MineSweeperCheater.Test
{
  [TestFixture]
  class TestCheater
  {
    [Test]
    public void GoodCase()
    {
      var input = new[]
                    {
                      "*  ",
                      " * ",
                      "  *",
                      " **",
                    };
      var result = Cheater.GenerateCheat(input);
      var expected = new[]
                    {
                      "121",
                      "222",
                      "243",
                      "122",
                    };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void NoMines()
    {
      var input = new[]
                    {
                      "      ",
                      "      ",
                      "      ",
                      "      ",
                    };
      var result = Cheater.GenerateCheat(input);
      var expected = new[]
                    {
                      "000000",
                      "000000",
                      "000000",
                      "000000",
                    };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void AllMines()
    {
      var input = new[]
                    {
                      "*******",
                      "*******",
                      "*******",
                      "*******",
                    };
      var result = Cheater.GenerateCheat(input);
      var expected = new[]
                    {
                      "3555553",
                      "5888885",
                      "5888885",
                      "3555553",
                    };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void EmptyStringArray()
    {
      var input = new string[] { };
      var result = Cheater.GenerateCheat(input);
      var expected = new string[] { };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void NullStrings()
    {
      var input = new string[] { null, null };
      var result = Cheater.GenerateCheat(input);
      var expected = new[] { "", "" };

      Assert.That(result, Is.EqualTo(expected));
    }

    [Test]
    public void EmptyStrings()
    {
      var input = new[] { "", "" };
      var result = Cheater.GenerateCheat(input);
      var expected = new[] { "", "" };

      Assert.That(result, Is.EqualTo(expected));
    }

  }
}
